home *** CD-ROM | disk | FTP | other *** search
-
-
- ; HSLMAIL4.SCR
-
- ; This script may be used *only* with QmodemPro for
- ; unattended mail transfers from Tomcat on Wildcat! BBSs which
- ; support Sam Smith's HSLINK file transfer protocol. Echo mail
- ; discussions are available via the RIME network in Conference
- ; #37 (The Toolshop) on the DRS BBS.
-
- ; This is a bulldog script - I call it a "bulldog" because it's
- ; written to repeatedly try and retry the call to your BBS
- ; even though it is blocked by timeouts, bad connections, or
- ; even crashed BBSs. As I discover such conditions, I have
- ; simply added necessary bulletproofing to the script to make it
- ; persist in the face of the new tribulation with the goal of
- ; having a script that only power or hardware failure in the
- ; user's machine can stop. However, since the script makes use
- ; of a number of disk write commands certain virus checkers may
- ; block the script's operation and make it unuseable.
-
- ; Copy it to your SCRIPTS subdirectory but do not link it in your
- ; QM phone directory to a BBS entry. This script must be called
- ; as QmodemPro is loaded with the DOS command string
- ; QMPRO /S=HSLMAIL4.SCR using the batch file named QMPHSL.BAT
- ; which is included here.
-
- ; HSLINK must be installed as an External File Transfer Protocol
- ; in QmodemPro. Instructions for installing an External
- ; FTP are contained in the documentation files accompanying
- ; QmodemPro and will not be repeated here.
-
- ; The upload batch file used by HSLINK may be named anything you
- ; choose and this script will accept and use that name. For
- ; illustration in the script I have used the name HSLUP.BAT for
- ; this batch file and if that is convenient for you to use it will
- ; do the job. But, whatever name you have used (or plan to use)
- ; in the installation of HSLINK as an External Protocol in
- ; QmodemPro you *must* use exactly the same upload batch filename
- ; when setting up this script for your system. I have included a
- ; file named HSLUP.BAT in this ZIP which is typical of the basic
- ; upload file used with HSLINK but the user may have written a
- ; customized upload file to use instead of this one. In practice,
- ; as this script loads it will save the existing upload batch file
- ; as HSLORIG.BAT and write a new batch file containing the correct
- ; HSLINK command string for a QWK/REP bidirectional mail transfer.
- ; Then, before exiting the script will delete the QWK/REP upload
- ; batch file and restore the original batch file with the name
- ; specified in $HSLUP during setup (e.g., HSLUP.BAT).
-
- ; Although not needed for this script to operate, I have also
- ; included the file HSLDWN.BAT to illustrate the basic HSLINK
- ; download file. Given the way HSLINK itself is written it
- ; will perform a bidirectional transfer with only the upload batch
- ; file if the command string it contains is the correct one.
-
- ; Please note, if you are running a virus checker that prevents
- ; any disk write - there will be a problem using this script
- ; and under some circumstances you may be unable to use it with
- ; that virus checking system.
-
- ; Since HSLINK will not auto-increment filenames on its own this
- ; script will rename $BBSID.QWK while loading to avoid any later
- ; filename conflict. This, too, may set off virus checking alarms
- ; since the DOS command RENAME involves a write to disk.
- ;
- ; For DRS BBS, your download directory is checked for a file named
- ; CTDRS.QWK and if found, the script will rename it using a numeral
- ; read from the file RENDAT.NUM (which the script itself will
- ; create the first time it is executed). HSLINK will then be able
- ; to download a new file named CTDRS.QWK without overwriting
- ; anything. If no file named CTDRS.QWK is found in your download
- ; directory the script will continue without renaming anything.
-
- ; After the numeral in RENDAT.NUM has been read and used for a
- ; rename it is incremented to provide a unique numeral for the
- ; next use by this renaming routine. This, too, involves a
- ; write to disk and may trigger a virus alarm.
-
- ; HSLMAIL4.SCR then will prompt you for a starting time and after
- ; that's entered then wait until that start time arrives
- ; before continuing. This permits you to easily change the
- ; time at which an unattended mail transfer is started from day to
- ; day.
-
- ; You are required to insert values for the variables USER,
- ; PASS, BBSID, BBSNUM, HSLUP, LIMIT, QMDIR, and PREFIX to suit
- ; your system and to be sure that QmodemPro is correctly configured
- ; as described below. The value presently assigned to
- ; BBSNUM is that of the DRS BBS but if you want to
- ; use this same script for calling some other Wildcat BBS just
- ; make the appropriate variable changes (and change the name of
- ; the script to avoid confusing the *.BAT programs).
-
- ;===== This script is written to take advantage of the ability of
- ;===== HSLINK to Auto-start. The Auto Download string must be entered
- ;===== in the field provided in Alt-N/C/P/E of QmodemPro. This
- ;===== string is HS*^BR.
-
- ;===== Check to be sure that you have QmodemPro configured so it
- ;===== will not save partial files.
-
- ;===== The BBS you call must support HSLINK or you cannot use it
- ;===== there. For maximum flexibility you may wish to go to Your
- ;===== Settings in the Main Menu of your Wildcat BBS and set
- ;===== Transfer Protocol to SELECT. This script will then select
- ;===== HSLINK just before the transfer. Alternatively, you must
- ;===== set Transfer Protocol to HSLINK or this script will derail
- ;===== as the BBS attempts a transfer with some other protocol you
- ;===== may have chosen as the default.
-
- ;===== When you are satisfied that HSLMAIL4.SCR is running
- ;===== correctly on your system, you may wish to remove all the
- ;===== Comments I've included here.
-
- ;===================== User Variables ===============================
-
- String BBSID BBSNUM LIMIT HSLUP HSLOLD NEWHSL PASS PADONE PADTWO PREFX QMDIR
- String USER RENDAT
-
- Assign USER "Karl Hakmiller" ;Insert your name - may not use
- ;$USERID variable in an unlinked
- ;script; space in name requires
- ;enclosing quotation marks.
-
- Assign PASS "xxxxx" ;Insert your password on the BBS
- ;and be certain you remove it
- ;before sharing the script.
-
- Assign BBSID CTDRS ;Insert the packet name for the
- ;BBS you are calling
-
- Assign BBSNUM 297-5907 ;Insert the phone number of the
- ;BBS being called; if spaces are
- ;used in the number enclose the
- ;whole number in double-quotes.
-
- Assign LIMIT 400 ;The BBS SysOp will have
- ;assigned a limit on the number
- ;of messages Tomcat will add to
- ;your packet following each DL
- ;command. I have written this
- ;script so that it will make
- ;REPEATED download passes if you
- ;reach the Message Limit that
- ;has been set for you - with the
- ;result you will receive all of
- ;your new mail providing only
- ;that your access level allots
- ;you enough on-line time. You'll
- ;see the limit allotted you on
- ;the screen when Tomcat runs the
- ;first time and you can change
- ;this variable accordingly.
-
- Assign PREFX ATDT ;Replace ATDT with ATDP if you
- ;are calling on a PULSE (Rotary
- ;Dial) line. ATDT is for a TONE
- ;line.
-
- Assign QMDIR F:\QMP\ ;Enter your QmodemPro home directory
-
- Assign HSLUP HSLUP.BAT ;Enter your preferred name for the HSLINK
- ;upload batch file
-
- Assign HSLOLD HSLORIG.BAT ;You may change this name assignment if
- ;necessary but it may be better to leave it
- ;as it is here.
-
- ;========================= No further changes required ===============
-
-
- ; This next section manages the renaming of a QWK packet which
- ; might cause a filename conflict on download.
-
- Assign RENDAT RENDAT.NUM ;Name of file - RENDAT.DAT - in
- ;your QMDIR containing the
- ;numeral which will be used to
- ;rename your QWK packets to
- ;prevent overwriting.
-
- Assign PADTWO 00 ;Left pad for RENDAT numerals
- ;less than 10
-
- Assign PADONE 0 ;Left pad numerals 10-99
-
-
- Assign 0 00:00:00 ;Reset starting time to 00:00:00
- Assign 1 0 ;Counter for RING attempts
- Assign 2 0 ;Counter for BULLDOG calls
- Assign 3 0 ;Counter for BUSTOUT calls
- Assign 4 0 ;Variable containing numeral 001-998
- Assign 5 0 ;Variable containing CONNECT speed
-
-
- EXIST $QMDIR$RENDAT OPEN1 ;Goes to OPEN1 if RENDAT.NUM already exists
- Openfile $QMDIR$RENDAT Rewrite ;Creates the file RENDAT.NUM if not there
- Assign 4 1
- Writefile 4 1 ;Writes the numeral 1 to the RENDAT.NUM file
- Closefile
-
- OPEN1:
- Openfile $QMDIR$RENDAT Read
- Readfile 4 ;Reads RENDAT.NUM content as integer value.
- Incr 4 ;Adds 1 to numeral found in RENDAT.NUM
- If "$4" >= "998" RESETIT ;Tests for limit of RENDAT numeral.
- If "$4" <= "9" PAD2 ;Left pads 1-9 with 00
- If "$4" <= "99" PAD1 ;Left pads 10-99 with 0
- Closefile
- Goto OPEN2
-
- RESETIT:
- Closefile
- Openfile $QMDIR$RENDAT Rewrite
- Assign 4 1 ;Resets $4 (998) to 1.
- Writefile 4 ;Writes $4 to RENDAT.NUM.
- Closefile
- Goto OPEN1
-
- PAD2: ;Pads RENDAT numerals < 10 with left 00.
- Closefile
- Openfile $QMDIR$RENDAT Rewrite
- Assign 4 "$PADTWO$4" ;Resets $4 (n < 10) to 00n).
- Writefile $4 ;Writes 00n to RENDAT.NUM.
- Closefile
- Goto CHECKDUP
-
- PAD1: ;Pads RENDAT numerals 10-99 with left 0
- Closefile
- Openfile $QMDIR$RENDAT Rewrite
- Assign 4 "$PADONE$4" ;Resets $4 (n 10-99 ) to 0n).
- Writefile $4 ;Writes 0n to RENDAT.NUM.
- Closefile
- Goto CHECKDUP
-
- OPEN2:
- Closefile
- Openfile $QMDIR$RENDAT Rewrite
- Writefile $4
- Closefile
-
-
- DisplayLn "Saving original upload file as $HSLOLD"
- Pause 2000
- DOS "COPY $QMDIR$HSLUP $QMDIR$HSLOLD" ;Save current upload file
- ;with temporary name
-
- CHECKDUP:
- EXIST $QWKPATH$BBSID.QWK RENAMEIT
- Goto NEWBAT
-
- RENAMEIT:
- Delay 2000
- DisplayLn "Found CTDRS.QWK - renaming to avoid conflicting filenames"
- Pause 2000
- DOS "COPY $QWKPATH$BBSID.QWK $BBSID$4.QWK" ;Renames old QWK packet
- ;with next numeral in
- ;RENDAT.NUM
-
- DOS "DEL $QWKPATH$BBSID.QWK" ;Deletes old QWK packet
-
- ;Note to advanced user: If QWK packets are deleted regularly the
- ;single command DOS "RENAME $QWKPATH$BBSID.QWK $BBSID$4.QWK" may
- ;be substituted for the COPY and DEL commands used.
-
-
-
- NEWBAT:
- Openfile $HSLUP Rewrite
- Assign NEWHSL "HSLINK -P%2 -U$QWKPATH$BBSID.QWK $REPPATH$BBSID.REP"
- Writefile "$NEWHSL" ;N.B.- quotes needed
- DisplayLn "$HSLUP now $NEWHSL"
- Closefile
-
-
- ;This next section prompts the user for a starting time
-
- RUNTIME:
- DisplayLn "Current system time is $TIME"
- DisplayLn "----------------------------"
- Display "Enter hh:mm:ss starting time: "
- Getn 0 8 ;GETN will accept 8 chars
- ;from the keyboard
- ;and assign them to
- ;the variable $0
- DisplayLn "You entered $0"
-
- DisplayLn "Script will begin to run at $0"
-
-
- WAITUNTIL $0
-
- ;The QWK/REP transfer script follows
-
- TIPTOP:
- TurnON ONLINE
- TurnON 8_BIT
- TurnOFF LINEFEED
- TurnOFF XON/XOFF
- TurnON NOISE
- TurnOFF MUSIC
- TurnON SCROLL
- TurnOff PRINT
- TurnOff SPLIT
- TurnOn STATUSLN
- TurnOFF DOORWAY
-
- Capture $DATE.HSL
- LOG MAIL.LOG ;Start a log running.
- Stamp ================ START LOG ENTRY =================
- Stamp LOG started on $DATE at $TIME
-
-
- LOOP1:
- Timeout 90 WARN :Set Timeout at 90 seconds
- Pause 500 ;Pause between dial attempts
- When
- Incr 1
- DisplayLn " ...Trying RING #$1 "
- When "BUSY" LOOP1
- When "VOICE" LOOP1
- When "NO CARRIER" LOOP1
- When "2400/ARQ" BULLDOG ;Delete if running in 2400/ARQ mode
- When "9600/V32" BULLDOG ;Delete if running in 9600/V32 mode
- When "?~?~?~?~?" BULLDOG
- Send "$PREFX$BBSNUM^M"
- Pause 500
- Waitfor "Connected at "
- Getx 5 4 b
-
- DisplayLn " Normal CONNECT has been made at $5 baud."
- Delay 500
- Stamp Normal CONNECT in $1 attempts on $DATE at $TIME
- Stamp Connected at $5 baud
- Clrscr
- Color 31
-
- TOP:
- Timeout 70 BULLDOG
- When
- When "9600/V32" BULLDOG ;Reject a non-HST link
- When "correctly" REPEAT ;Sent name incorrectly, try again
- When "Wrong" "$PASS^M" ;Sent password incorrectly
- When "NO CARRIER" BULLDOG
- Waitfor "first name" ;This is the Fast Login route to
- Delay 100 ;the Tomcat Mail Door (!). It skips
- Send "!$USER $PASS^M" ;opening Bulletins/Newsletters/Menus
-
-
- TOMMY:
- Flush COM
- Timeout 70 BULLDOG
- When
- When "Qmodem Host Command" BBSDOWN ;QM HOST may be up when BBS is down
- When "top?" "C^M"
- Waitfor "TOMCAT MENU [D U"
- Delay 200
- Send "D^M" ;Begin Download Mode
- Delay 100
-
- Timeout 600 BULLDOG
- When
- When "NO CARRIER" BULLDOG
- When "Total messages found: $LIMIT" PUSHMORE ;More mail possible
- When "Nothing found to download" CHEKREP
- CONT1:
- When "done?" "Y^M" ;Accept download
- When "PROTOCOL MENU" "H^M" ;Select HS/LINK
- Waitfor "Start" ;Begin transfer
- Delay 100
- Upload H $REPPATH$BBSID.REP ;Note that the HSLINK
- ;*upload* batch file will
- ;be called but the
- ;download will also be
- ;done by HSLINK
-
- MOREMAIL:
- Pop 4 ;Take $4 from stack
- If "$4" = "MORE" TOMMY ;Go for more mail
-
- If $SUCCESS SCRUBREP ;Delete uploaded REP file
- Goto GETOUT
-
- CHEKREP:
- Exist $REPPATH$BBSID.REP DOUP
- Goto GETOUT
-
- DOUP:
- Timeout 60 ABORT
- Waitfor "TOMCAT MENU [D U"
- Send "U^M"
-
- Timeout 60 ABORT
- When "PROTOCOL MENU" "H^M" ;Select HS/LINK
- Waitfor "Start"
- Delay 100
- Upload H $REPPATH$BBSID.REP
-
- If $SUCCESS SCRUBREP ;Delete uploaded REP file
- Goto GETOUT
-
- REPEAT:
- Send "N^M"
- Delay 100
- Send "^M"
- Stamp Incorrect Name/Password on $DATE at $TIME
- Goto TOP
-
- WARN:
- Color 15
- Clrscr
- Note Timed out while waiting for CONNECT.
- Note This indicates that a non-standard return code was received.
- Note Standard return codes: CONNECT, BUSY, VOICE, NO CARRIER, and NO DIALTONE
- DisplayLn "Pausing 8 seconds before continuing to BULLDOG..."
- Pause 8000
-
- BULLDOG:
- Stamp BULLDOG engaged after $1 RINGS on $DATE at $TIME
- Clrscr
- Incr 2
- DisplayLn "Bulldog engaged - pausing 10 seconds before the next bite!"
- Box 1 3 44 15
- Color 46
- DisplayLn " "
- DisplayLn " ......... "
- DisplayLn " /^) ...........(^ \ "
- DisplayLn " / <_<_...._>_> \ "
- DisplayLn " / /.. -.- -.- ..\ \ "
- DisplayLn " | | ... ( ) ... | | "
- DisplayLn " ~ ... ____ ... ~ "
- DisplayLn " .... Vv-------vV.... "
- DisplayLn " ................ "
- DisplayLn " "
- DisplayLn " "
- Pause 10000
- Color 14
- Stamp Bulldog has now been called $2 times on $DATE ;Log message
- TurnOff LOG
- Hangup
- Gosub BIGSCRN
- Clrscr
- Goto TIPTOP
-
- PUSHMORE:
- Assign 4 MORE ;Assign MORE to $4
- Push $4 ;Push MORE on stack
- Goto CONT1 ;Go get pending mail packet
-
- SCRUBREP:
- Deletef $REPPATH$BBSID.REP
- Delay 100
- Goto GETOUT
-
- BBSDOWN:
- Stamp Connected Qmodem HOST on $DATE at $TIME
- Stamp Exited HOST at $TIME
- TurnOff LOG
- Send "G^M"
- Hangup
- Goto TIPTOP
-
- GETOUT:
- Timeout 30 CHECKOUT
- Clrscr
- Gosub BIGSCRN
- Waitfor "TOMCAT MENU [D U C H G Q]:"
- Delay 100
- Send "G^M" ;Be polite - issue Goodbye
-
- CHECKOUT:
- Timeout 30 BAILOUT
- When
- When "[Y/n]?" "^M" ;Confirm logoff request
- Delay 100
- Waitfor "NO CARRIER"
- Delay 100
- Hangup ;Be sure you are offline
- DisplayLn " Normal exit from script"
- Delay 500
- Stamp NORMAL exit on $DATE at $TIME
- Stamp ================= END ==========================
- Gosub RESTORE
- TurnOff LOG
- System Y ;Leave script & QM for DOS
-
- BAILOUT:
- Stamp Bailed out on $DATE at $TIME
- Stamp ============== BAILED OUT =====================
- Gosub RESTORE
- TurnOff LOG
- Hangup
- System Y
-
- BIGSCRN: ;This is a SUBROUTINE
- Window 1 1 80 24 ;Make screen 80x24
- Color 31 ;Make screen bright white on blue
- Return ;Return to next script line
-
- RESTORE: ;This is another SUBROUTINE
- DOS "DEL $QMDIR$HSLUP" ;Delete new QWK/REP upload file
- DOS "COPY $QMDIR$HSLOLD $QMDIR$HSLUP" ;Restore original upload file
- DisplayLn "$HSLUP has been restored with original content"
- Pause 2000
- Return
-